#include <stdio.h>
#include <string.h>


int  myStrlen(const char * str)
{

    #if 0
    int jdx = 0;
    if(str == NULL)//所有指针都要判空
    {
        return 0;
    }
    while( str[jdx] != '\0')//*(str+jdx)==str[jdx]
    {
        jdx++;
    }

    /*改*/
    //str[0] = 'H';
    return jdx;
}

#else

    int count = 0;
    while(*str != '\0')
    {
        count++;
        str++;

    }

int main()
{
    //计算

    char ptr[] = "hello world";
    /*
    int len = sizeof(ptr);
    printf("len:%d\n", len);
    for(int idx = 0; idx < len; idx++)
    {
        printf("%c\n",ptr[idx]);
    }
    strlen(ptr);
    */

    int size = myStrlen(ptr);//求长度
    printf("size=%d\n",size);
    printf("%s\n", ptr);

    /* ptr[X ]= *(ptr + X) */
    printf("ptr[1]:%c\n", ptr[3]);
    printf("*(ptr+1):%c\n", *(ptr+3));

    printf("*ptr:%c,%p\n", *ptr,ptr);//*(ptr=0),ptr(0)


    return 0;
    
}





